package com.TwinBlade.PicturePassword;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main extends PreferenceActivity
  implements Preference.OnPreferenceClickListener
{
  private Preference a;
  private Preference b;
  private Preference c;
  private Preference d;
  private Preference e;
  private Preference f;
  private Preference g;
  private Preference h;
  private Preference i;
  private Preference j;
  private SharedPreferences k;
  private Context l;
  private int m = -1;
  private final Runnable n = new ap(this);

  private int a()
  {
    try
    {
      int i1 = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode;
      return i1;
    }
    catch (Exception localException)
    {
    }
    return 0;
  }

  private String a(String paramString)
  {
    if (paramString.equals("point"))
      return getString(2131296465);
    if (paramString.equals("line"))
      return getString(2131296466);
    if (paramString.equals("circle"))
      return getString(2131296467);
    if (paramString.equals("none"))
      return getString(2131296464);
    return "Error";
  }

  private String b()
  {
    try
    {
      String str = getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
      return str;
    }
    catch (Exception localException)
    {
    }
    return "Unknown";
  }

  private String c()
  {
    BufferedReader localBufferedReader = new BufferedReader(new InputStreamReader(getResources().openRawResource(2131165184)));
    StringBuilder localStringBuilder = new StringBuilder();
    try
    {
      while (true)
      {
        String str = localBufferedReader.readLine();
        if (str == null)
          return localStringBuilder.toString();
        localStringBuilder.append(str);
        localStringBuilder.append('\n');
      }
    }
    catch (Exception localException)
    {
    }
    return "Error";
  }

  private void d()
  {
    String str1 = this.k.getString("FirstGestureType", "none");
    String str2 = this.k.getString("SecondGestureType", "none");
    String str3 = this.k.getString("ThirdGestureType", "none");
    if (!bd.a(this))
    {
      this.c.setSummary(a(str1) + " - " + a(str2) + " - " + a(str3));
      return;
    }
    String str4 = this.k.getString("FourthGestureType", "none");
    String str5 = this.k.getString("FifthGestureType", "none");
    this.c.setSummary(a(str1) + " - " + a(str2) + " - " + a(str3) + " - " + a(str4) + " - " + a(str5));
  }

  private void e()
  {
    new au(this).start();
  }

  private void f()
  {
    if (bd.a(this))
    {
      this.i.setTitle(getString(2131296285));
      String str = getString(2131296286);
      if (!this.k.getString("PayPalKey", "-1").equals("-1"))
        str = str + ". Press to copy the PayPal Serial Key";
      while (true)
      {
        this.i.setSummary(str);
        return;
        this.i.setEnabled(false);
      }
    }
    this.i.setTitle(getString(2131296287));
    this.i.setSummary("");
    this.i.setEnabled(true);
  }

  protected void onActivityResult(int paramInt1, int paramInt2, Intent paramIntent)
  {
    super.onActivityResult(paramInt1, paramInt2, paramIntent);
    switch (paramInt1)
    {
    default:
    case 1:
    }
    do
      return;
    while (!this.k.getBoolean("ShowHint", true));
    Utilities.c(this.l);
    this.k.edit().putBoolean("ShowHint", false).commit();
  }

  public void onCreate(Bundle paramBundle)
  {
    Utilities.e(this);
    super.onCreate(paramBundle);
    this.k = PreferenceManager.getDefaultSharedPreferences(this);
    if (this.k.getBoolean("ShowSetupWizard", true))
      startActivityForResult(new Intent(this, SetupWizard.class), 1);
    addPreferencesFromResource(2131099648);
    this.l = this;
    this.a = findPreference("mainImage");
    this.b = findPreference("mainGestures");
    this.d = findPreference("mainTest");
    this.e = findPreference("mainStart");
    this.f = findPreference("mainStop");
    this.g = findPreference("mainPreferences");
    this.h = findPreference("mainSupport");
    this.j = findPreference("mainAbout");
    this.c = findPreference("CurrentlyEnabledGestures");
    this.i = findPreference("PlusKey");
    this.a.setOnPreferenceClickListener(this);
    this.b.setOnPreferenceClickListener(this);
    this.d.setOnPreferenceClickListener(this);
    this.e.setOnPreferenceClickListener(this);
    this.f.setOnPreferenceClickListener(this);
    this.g.setOnPreferenceClickListener(this);
    this.h.setOnPreferenceClickListener(this);
    this.j.setOnPreferenceClickListener(this);
    this.c.setOnPreferenceClickListener(this);
    this.i.setOnPreferenceClickListener(new at(this));
    if (a() > this.k.getInt("logVersion", 0))
    {
      Utilities.a(this, c());
      this.k.edit().putInt("logVersion", a()).commit();
    }
    Utilities.a = false;
  }

  public boolean onPreferenceClick(Preference paramPreference)
  {
    Intent localIntent3;
    boolean bool2;
    if (paramPreference.equals(this.c))
      if (bd.a(this.l))
      {
        localIntent3 = new Intent(this.l, GesturePreferencesPlus.class);
        startActivity(localIntent3);
        bool2 = true;
      }
    boolean bool1;
    do
    {
      return bool2;
      localIntent3 = new Intent(this.l, GesturePreferences.class);
      break;
      if (paramPreference.equals(this.a))
      {
        startActivity(new Intent(this, Image.class));
        return true;
      }
      if (paramPreference.equals(this.b))
      {
        if (Utilities.a(false, true))
        {
          Intent localIntent2 = new Intent(this, SaveActivity.class);
          localIntent2.putExtra("Code", "Save");
          startActivity(localIntent2);
        }
        return true;
      }
      if (paramPreference.equals(this.d))
      {
        if (Utilities.a(true, true))
        {
          Intent localIntent1 = new Intent(this, SaveActivity.class);
          localIntent1.putExtra("Code", "Test");
          startActivity(localIntent1);
        }
        return true;
      }
      if (paramPreference.equals(this.e))
      {
        if (Utilities.a(true, true))
        {
          startService(new Intent(this, AService.class));
          Utilities.a(this, getString(2131296449), 3, true);
          this.k.edit().putBoolean("MainEnabled", true).commit();
        }
        return true;
      }
      if (paramPreference.equals(this.f))
      {
        stopService(new Intent(this, AService.class));
        Utilities.a(this, getString(2131296450), 3, true);
        this.k.edit().putBoolean("MainEnabled", false).commit();
        return true;
      }
      if (paramPreference.equals(this.g))
      {
        startActivity(new Intent(this, Preferences.class));
        return true;
      }
      if (paramPreference.equals(this.h))
      {
        startActivity(new Intent(this, Support.class));
        return true;
      }
      bool1 = paramPreference.equals(this.j);
      bool2 = false;
    }
    while (!bool1);
    Utilities.a(this, "Version: " + b() + "\n" + "Application Developed By: TwinBlade Corp." + "\n" + "With Special Thanks To: " + "\n" + "French Translator: Cunione" + "\n" + "German Translator: David M." + "\n" + "Romanian Translator: Catalin V.");
    return false;
  }

  public void onResume()
  {
    super.onResume();
    f();
    d();
    e();
  }
}

/* Location:           D:\Studium\Bachelorarbeit\BA Marcus Wobig\BA\BA\Decompiler\PicturePassword APK\Programm\PicturePassword_dex2jar.jar
 * Qualified Name:     com.TwinBlade.PicturePassword.Main
 * JD-Core Version:    0.6.2
 */